<?php

namespace Yolo\Components\Cache;

use Yolo\Di\Annotations\Singleton;

/**
 * Cache Factory
 * @method mixed get(string $key)
 * @method void set(string $key, mixed $value, int $expireIn = 3600)
 * @method int|false delete(string $key)
 * @method void clear()
 * @method bool exists(string $key)
 */
#[Singleton]
class CacheFactory
{
    public function __construct(
        private readonly CacheInterface $cache
    ){}

    public function __call($name, $arguments)
    {
        return $this->cache->$name(...$arguments);
    }
}
